﻿using OneOfAll.Common.Util;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OneOfAll.Common.Models
{
    public class CityInfoModel : BaseModel
    {
        private int width = 64;
        public int Width
        {
            get { return width; }
            set { width = value; RaisePropertyChanged(); }
        }

        private int height = 64;
        public int Height
        {
            get { return height; }
            set { height = value; RaisePropertyChanged();}
        }

        private ObservableCollection<ConstructionModel> constructionList = new ObservableCollection<ConstructionModel>();
        public ObservableCollection<ConstructionModel> ConstructionList
        {
            get { return constructionList; }
            set {  constructionList = value; RaisePropertyChanged();}
        }

        private ObservableCollection<ConstructionModel> availableConstructionList = new ObservableCollection<ConstructionModel>();
        public ObservableCollection<ConstructionModel> AvailableConstructionList
        {
            get { return availableConstructionList; }
            set { availableConstructionList = value; RaisePropertyChanged(); }
        }

        public List<int> GetFullConstruction()
        {
            //List<int> list = new List<int>();
            ////生产
            //list.AddRange(ConstructionList.Where(t => t.ConstructionType == ConstructionTypeEnum.生产 && t.Plan_PeopleList.Count < t.MaxPeopleCount && 
            //(t.ProductionInfo.ResourceDemandCount > 0 && t.ProductionInfo.ResourceKeyList.Count > 0 || t.ProductionInfo.ResourceDemandCount == 0)).Select(x => x.Key));
            ////培养
            //list.AddRange(ConstructionList.Where(t => t.ConstructionType == ConstructionTypeEnum.培养).Select(x => x.Key));
            //return list;

            return ConstructionList.Where(t => t.Plan_PeopleList.Count >= t.MaxPeopleCount && t.ConstructionType != ConstructionTypeEnum.资源 &&
            (t.ConstructionType != ConstructionTypeEnum.生产) || (t.ConstructionType == ConstructionTypeEnum.生产 && t.ProductionInfo.ResourceDemandCount > 0 &&
            t.ProductionInfo.ResourceKeyList.Count == 0)).Select(x => x.Key).ToList();
        }
    }


}
